import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';
import {promptBox} from 'nc-lightapp-front';

export default function initDieProcData() {
    const {orgVal, isInJob, selectedPsn, form} = this.props;

    let postData = {
        isInJob,
        pk_psnjob: selectedPsn,
        pk_org: orgVal.refpk
    };

    return proFetch({
        url: '/nccloud/hrtrn/dimissionrds/DimissionRdsDieCheckAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                promptBox(
                    {
                        color: "warning",
                        title: this.props.json['hi6007-000174'],/* 国际化处理： 确认,确认*/
                        content: this.props.json['hi6007-000157'],/* 国际化处理： 您确定对所选人员做身故处理吗？*/
                        beSureBtnClick: () => {
                            this.props.updateState({
                                dieProcModalVisible: true
                            });
                            form.setAllFormValue({'passaway': res.data.passaway});
                            form.setFormStatus('passaway', 'edit');
                        }
                    });
            }
        });
}
